var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		pagId : 'paging',
		l_column : [{
			colkey : "checkDate",
			name : "检查日期",
			renderData : function(rowindex,data, rowdata, column) {
				if(data!=''){
					return new Date(data).format("yyyy-MM-dd");
				}else{
					return "";
				}
			}
		}, {
			colkey : "mold_encode",
			name : "模具编号"
		}, {
			colkey : "checkDate",
			name : "检查时间",
			renderData : function(rowindex,data, rowdata, column) {
				if(data!=''){
					return new Date(data).format("hh:mm:ss");
				}else{
					return null;
				}
			}
		}, {
			colkey : "userName",
			name : "检查人"
		}],
		jsonUrl : rootPath + '/pBeforeCheck/pBeforeCheck_findByPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	$("#editFun").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});
});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1 || cbox == "") {
		layer.msg("只能选中一个");
		return;
	}
	pageii = layer.open({
		title : "编辑备模前模具质量检查表",
		type : 2,
		area : [ "1200px", "100%" ],
		content : rootPath + '/pBeforeCheck/pBeforeCheck_edit.shtml?id=' + cbox
	});
}
